package com.baselibrary.libs.design_mode.Observable_demo.Observer;

import com.baselibrary.libs.Utils.netUtils.NoHttp.queue.Request_netWork;

/**
 * Created by Administrator 于萌萌
 * 创建日期: 14:21 . 2017年03月01日
 * 描述:
 * <p>
 * <p>
 * 备注:
 */

public class NetTool{
    static NetTool sNetTool;


    public static NetTool getInstances(){
        synchronized (NetTool.class){
            if (null == sNetTool)

                return sNetTool = new NetTool();
        }
        return sNetTool;
    }
    private NetTool(){}


    public Requests getRequests(){
        return new Requests();
    }


    /**
     * 内部请求类
     * @param <T>
     */
    public class Requests<T>{
        Class<T> clazz;
        Request_netWork netWork;

        /**
         * 设置请求体
         * @param netWork
         * @return
         */
        public Requests setRequests (Request_netWork netWork){
            this.netWork =netWork;

            return this;
        }

        /**
         * 设置jsonbean
         * @param clazz
         * @return
         */
        public Requests jsonBean (Class<T> clazz){
            this.clazz = clazz;
            return this;
        }

        public Request_netWork sendRequests(BaseObserver.CallBack<T> tCallBack){
           new MyObserver(netWork,clazz,tCallBack);

            return netWork;
        }


    }







}
